home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************************************
- *
- *
- * MacZoop - "the framework for the rest of us"
- *
- *
- *
- * ZPlugIn.h -- a generic plug-in object
- *
- *
- *
- *
- *
- * © 1997, Graham Cox
- *
- *
- *
- *
- *************************************************************************************************/
-
- #pragma once
-
- #ifndef __ZPLUGIN__
- #define __ZPLUGIN__
-
-
- #include "ZResourceFile.h"
- #include "ZDefines.h"
-
- // abstract class definition:
-
- class ZPlugIn : public ZResourceFile
- {
- protected:
- UniversalProcPtr entryPointUPP; // upp to plug-in code
- Str255 plName; // plug-in name
-
- public:
-
- ZPlugIn( const FSSpec& plugFile ) : ZResourceFile( plugFile ) {};
- ~ZPlugIn() {};
-
- virtual OSErr InitPlugIn() { LoadPlugInCode(); return noErr; };
- virtual OSErr OpenPlugIn() { return noErr; };
- virtual OSErr CallPlugIn( const long message, void* msgData ) { return noErr; };
- virtual OSErr ClosePlugIn() { return noErr; };
-
- virtual void GetName( Str255 aName ) { CopyPString( itsSpec.name, aName ); };
-
- protected:
-
- virtual void LoadPlugInCode() { entryPointUPP = NULL; };
- };
-
- // This class is the basis for a plug-in architecture. Plug-Ins are based on resource files
- // so they can have their own resources. This class is an abstract base-class and the actual
- // implementation is left to your own subclasses. An associated object, ZPlugInHandler, is
- // responsible for gathering the available plug-ins into a list and passing messages to
- // them. You are responsible for establishing a common format and protocol for your plug-ins-
- // this class does not force you to use any particular arrangement, though you are expected
- // to set <entryPointUPP> to be a valid UPP to your plug-ins code.
-
- // Note that building a plug-in architecture is quite an advanced topic, which is why you
- // don't get all that much help here. MacZoop provides a loose framework, but you'll need to
- // fill in pretty much all of the detail since plug-in schemes can vary widely.
-
-
- #endif